home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_541 / steal / src / showwin.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  93 lines

  1. /****************************************************************************
  2.  
  3.                 ShowWin.c
  4.  
  5.     This file should be linked together with a compiled version
  6.     of Stolen.c, or whatever it's name may be. That file must
  7.     contain the following:
  8.      - A NewWindow structure: The Window to be shown;
  9.     Note that a Menu hanging from the Window should be stolen sperately
  10.     because a struct NewWindow cannot contain sucha a field.
  11.  
  12.                     Rick van Rein, October 2, 1990
  13.  
  14. ****************************************************************************/
  15.  
  16.  
  17.  
  18. #include <functions.h>
  19.  
  20. #include <Intuition/Intuition.h>
  21.  
  22.  
  23. struct IntuitionBase *IntuitionBase;
  24.  
  25. extern struct NewWindow *nwin1;
  26.  
  27.  
  28. /***** This routine opens a Window with a Close-Gadget in it: */
  29.  
  30.  
  31. #define BLUE_0      0
  32. #define WHITE_1     1
  33. #define BLACK_2     2
  34. #define ORANGE_3    3
  35.  
  36.  
  37. struct NewWindow closewin =
  38.  {
  39.    30,30,                    /* LeftEdge,TopEdge */
  40.    360,10,                    /* Width,Height */
  41.    BLUE_0,WHITE_1,                /* DetailPen,BlockPen */
  42.    CLOSEWINDOW,                    /* IDCMPFlags */
  43.    WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE | SMART_REFRESH,
  44.                         /* Flags */
  45.    NULL,                    /* FirstGadget */
  46.    NULL,                    /* CheckMark */
  47.    (UBYTE *) " <<< Click here to finish ShowWin ",
  48.                         /* Title */
  49.    NULL,                    /* Screen */
  50.    NULL,                    /* BitMap */
  51.    -1,-1,                    /* MinWidth,MinHeight */
  52.    -1,-1,                    /* MaxWidth,MaxHeight */
  53.    WBENCHSCREEN                    /* Type */
  54.  };
  55.  
  56. void WaitForClick ()
  57.  {
  58.    struct Window *win;
  59.  
  60.    if (win=OpenWindow (&closewin))
  61.     {
  62.       WaitPort (win->UserPort);
  63.       ReplyMsg (GetMsg (win->UserPort));    /* Our Gadget was Clicked */
  64.       CloseWindow (win);
  65.     }
  66.    else
  67.       puts ("\tShowWin: Can't open Window on Workbench Screen");
  68.  }
  69.  
  70.  
  71. /***** The main routine of the showing mechanism: */
  72.  
  73. main ()
  74.  {
  75.    struct Window *win;
  76.  
  77.    if (!(IntuitionBase=(struct IntuitionBase *) OpenLibrary ("intuition.library",0L)))
  78.     {
  79.       puts ("\tShowWin: Can't open intuition.library (?)");
  80.       exit (0);
  81.     }
  82.  
  83.    if (! (win=OpenWindow (&nwin1)))
  84.       puts ("\tShowWin: Can't open Window to be shown");
  85.    else
  86.     {
  87.       WaitForClick ();
  88.       CloseWindow (win);
  89.     }
  90.  
  91.    CloseLibrary (IntuitionBase);
  92.  }
  93.